package com.xuyuan.thread.create;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class MyCallable implements Callable<String> {
    public static void main(String[] args) throws Exception {
        ExecutorService executor = Executors.newSingleThreadExecutor();
        Future<String> future = executor.submit(new MyCallable());
        String result = future.get(); // 阻塞直到结果可用
    }

    @Override
    public String call() throws Exception {
        // TODO 线程执行逻辑
        return "123";
    }
}
